#!/bin/bash
#
source /etc/profile
echo "run as root!"
sleep 10
MARCIMPORT=/usr/local/marcimport
SABRE=/usr/local/vufind-smu
# Disable JETTY_CONSOLE output -- it causes problems when run by cron:
export JETTY_CONSOLE=/dev/null
# run as root
date

# delete current solr index
echo "Stop vufnd and take a backup of the solr index"
cd $SABRE
./vufind.sh stop
sleep 5
rm -rf solr/biblio/index.old
mv solr/biblio/index solr/biblio/index.old
sleep 5
./vufind.sh start
sleep 10
ls -l $SABRE/solr/biblio/
chown -R libadmin:www-data $SABRE/solr/biblio/index
ls -l $SABRE/solr/biblio/
cd $SABRE/import
cp solrmarc.log solrmarc.log.old
touch solrmarc.log
chmod 774 solrmarc.log
chown libadmin:www-data solrmarc.log

echo solr backup complete...
sleep 10

